package org.pdai.basic.generics;

public class GenericsExample2 {
    public static void main(String[] args) {
        Info2<String> info1 = new Info2<>();
        Info2<Object> info2 = new Info2<>();
        info1.setVar("hello");
        info2.setVar(new Object());
        func(info1);
        func(info2);
    }

    private static void func(Info2<? super String> temp) {
        System.out.println(temp + ", ");
    }
}

class Info2<T> {
    private T var;

    public T getVar() {
        return var;
    }

    public void setVar(T var) {
        this.var = var;
    }

    @Override
    public String toString() {
        return "Info2{" +
                "var=" + var +
                '}';
    }
}
